package com.daka.service.impl;

import com.daka.dao.SpreadInsuranceDao;
import com.daka.entity.SpreadInsurance;
import com.daka.service.SpreadInsuranceService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author beliveli on 2016/3/31 0031.
 */
@Service("spreadInsuranceService")
@SuppressWarnings("unused")
public class SpreadInsuranceServiceImpl implements SpreadInsuranceService {

    @Resource
    private SpreadInsuranceDao spreadInsuranceDao;

    @Override
    public SpreadInsurance create(SpreadInsurance spreadInsurance) {
        spreadInsuranceDao.insert(spreadInsurance);
        return spreadInsurance;
    }

    @Override
    public SpreadInsurance findById(Long id) {
        return spreadInsuranceDao.selectByPrimaryKey(id);
    }

    public SpreadInsurance findByVolunteerCode(String volunteerCode) {
        return spreadInsuranceDao.findByVolunteerCode(volunteerCode);
    }

    @Override
    public SpreadInsurance updateById(SpreadInsurance spreadInsurance) {
        spreadInsuranceDao.updateByPrimaryKeySelective(spreadInsurance);
        return spreadInsurance;
    }
}
